#!ipxe

:utils_menu
menu Utilities
item --gap Utilities:
{% for key, value in utilitiesefi.items() | sort(attribute='1.name') %}
{% if value.enabled %}
item {{ key }} ${space} {{ value.name }}
{% endif %}
{% endfor %}
item --gap netboot.xyz tools:
item cmdline ${space} Kernel cmdline params: [${cmdline}]
item nbxyz-custom ${space} Set Github username [user: ${github_user}]
item nbxyz ${space} netboot.xyz endpoints
choose --default ${menu} menu || goto utils_exit
echo ${cls}
goto ${menu} ||
chain ${menu}.ipxe || goto utils_exit
goto utils_exit

{% for key, value in utilitiesefi.items() | sort %}
{% if value.enabled | bool and value.type == "direct" %}
:{{ key }}
imgfree
kernel {{ value.kernel }}
initrd {{ value.initrd }}
boot
goto utils_exit
{% endif %}
{% endfor %}

:cmdline
echo If you want to change the default kernel command line parameters
echo you can override the defaults here.
echo
echo Currently set to: ${cmdline}
echo
echo -n Enter cmdline parameters: ${} && read cmdline
goto utils_menu

:nbxyz-custom
echo EXPERIMENTAL
echo 
echo Make sure you have a fork of https://github.com/netbootxyz/netboot.xyz-custom.
echo You can then customize your fork as needed and set up your own custom options.
echo Once your username is set, a custom option will appear on the main menu.
echo
echo -n Please enter your Github username: ${} && read github_user
goto utils_menu

:utils_exit
clear menu
exit 0
